﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CarShop
{
    public class Car : Vehicle, IDescriptive
    {
        //fields
        private Engine carEngine;
        private Transmission transmission;
        private List<string> description = new List<string>();

        //constructor
        public Car(string brand, string model, string color, int year, int speed, int price, Engine carEngine, Transmission transmission)
            : base(brand, model, color, year, speed, price)
        {
            this.CarEngine = carEngine;
            this.Transmission = transmission;
        }
        public Car(string brand, string model, string color, int year, int speed, int price, Engine carEngine, Transmission transmission, List<string> description)
            : this(brand, model, color, year, speed, price, carEngine, transmission)
        {
            this.Description = description;
        }

        //properties
        public Transmission Transmission
        {
            get
            {
                return this.transmission;
            }
            set
            {
                this.transmission = value;
            }
        }

        public Engine CarEngine
        {
            get
            {
                return this.carEngine;
            }
            set
            {
                this.carEngine = value;
            }
        }

        public List<string> Description
        {
            get { return description; }
            set
            {
                this.description = value;
            }
        }

        public void AddComment(string extra)
        {
            this.description.Add(extra);
        }

        public override string AdditionalInfo()
        {
            StringBuilder someCar = new StringBuilder();
            someCar.AppendLine(this.CarEngine.ToString());
            someCar.AppendLine("Transmission: " + this.Transmission.ToString());
            foreach (var extra in Description)
            {
                someCar.Append(extra.ToString() + " ");
            }

            return someCar.ToString();
        }
        

    }
}
